home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 11 / Cream of the Crop 11-1.iso / sound / sbplay25.zip / SOURCE.ZIP / sound.h < prev   
C/C++ Source or Header  |  1996-01-02  |  11KB  |  306 lines

  1. /* sound.h - header for sound functions                                 */
  2. /* John A. Ball   Jan 2, 1996                                           */
  3.  
  4. /* Sound Structure used by Sound Player Utility                         */
  5.  
  6. struct SOUND{
  7.     unsigned long length;               /* Number of bytes              */
  8.     unsigned long number_samples;       /* Number of PCM Samples        */
  9.     unsigned long frequency;            /* Frequency of playback        */
  10.     unsigned int  volume;               /* Volume to play sample        */
  11.     int           bits;                 /* Bits per Channel & sign      */
  12.     unsigned int  channels;             /* Number of Channels           */
  13.     unsigned int  compression;          /* Type of Hardware Compression */
  14.     int           byte_format;          /* Intel/Motorola byte format   */
  15. };
  16.  
  17.  
  18. /* Define Types of Sound Boards/Systems */
  19.  
  20. #define PCSPEAKER       0
  21. #define TANDYSND       10
  22. #define BLASTER        20
  23. #define WSS            30
  24. #define DIGPAK         40
  25. #define CODEC          50
  26.  
  27. struct CARD_INFO{
  28.     unsigned int type;                  /* Type of Sound Card */
  29.     unsigned int io_addr;               /* I/O Address of sound card */
  30.     unsigned int irq;                   /* IRQ used by sound card  */
  31.     unsigned int dma;                   /* DMA channel used by sound card */
  32.     unsigned int mode;                  /* Type of data format */
  33. };
  34.  
  35. /* Define data format & data compression types */
  36.  
  37. #define BIT8_M  0x01            /* 8 Bit Mono PCM data */
  38. #define BIT8_S  0x02            /* 8 Bit Stereo */
  39. #define BIT16_M 0x04            /* 16 Bit Mono */
  40. #define BIT16_S 0x08            /* 16 Bit Stereo */
  41. #define ULAW    0x10            /* Ulaw Compression */
  42. #define ALAW    0x20            /* Alaw Compression */
  43. #define MSADPCM 0x40            /* Microsoft ADPCM Compression */
  44. #define ADPCM   0x80            /* ADPCM Compression 4-bit */
  45. #define TCOMP   0x100           /* Tandy Compression */
  46. #define ADPCM4  0x200           /* ADPCM 4-bit Compression */
  47. #define ADPCM26 0x400           /* ADPCM 2.6 bit Compression */
  48. #define ADPCM2  0x800           /* ADPCM 2 bit Compression */
  49. #define MACCOMP 0x1000          /* MAC compression */
  50. #define UNKNOWN 0x8000          /* Unknown type compression */
  51. #define INTEL   0x0000          /* Intel byte format for 16 bit sound */
  52. #define MM      0xffff          /* Motorolo byte format for 16 bit sound */
  53.  
  54. /* Sound structure for use by DIGPAK drivers */
  55.  
  56. struct SNDSTRUC{
  57.     unsigned char _far *sound;          /* Pointer to sound data */
  58.     unsigned short sndlen;              /* Length of audio data */
  59.     short _far *IsPlaying;              /* Pointer to play status flag */
  60.     short  frequency;                   /* Playback frequency */
  61. };
  62.  
  63. /* Sound File Formats  */
  64.  
  65. #define TANDY_type 0xffff00ff
  66.  
  67. /* Old Tandy Sound File Format */
  68.  
  69. struct OLDTANDY{
  70.         char id;                        /* 1a */
  71.         char compression;               /* 0 = none */
  72.         char number_clips;
  73.         char voice;
  74.         char name[10];                  /* asciiz */
  75.         unsigned int frequency;
  76. };
  77. struct OLDTANDY_R{
  78.         unsigned long type;             /* ff 00 ff ff */
  79.         unsigned long start;
  80.         unsigned long length;
  81.         unsigned long unknown;
  82.         unsigned long number_samples;
  83.         unsigned long unknown1;
  84.         unsigned long unknown2;
  85. };
  86. /* My version of Deskmate's SND Format */
  87.  
  88. struct TANDY{
  89.     char name[44];                      /* asciiz Instrument or desc */
  90.     unsigned int  id;                   /* 1a 80 for last version */
  91.     unsigned int  number_clips;         /* Sound Count */
  92.     unsigned char voice;                /* Instrument number */
  93.     unsigned char unknown[17];
  94.     unsigned int  compression;          /* Compression Type */
  95.     unsigned char unknown1[20];         /* Compression info */
  96.     unsigned int  frequency;            /* Sampling Rate */
  97.     unsigned char unknown2[24];
  98. };
  99. struct TANDY_R{
  100.     unsigned long link;
  101.     unsigned char unknown1[2];
  102.     unsigned long type;                 /* FF 00 FF FF          */
  103.     unsigned long start;
  104.     unsigned long length;
  105.     unsigned long number_samples;
  106.     unsigned char unknown2[24];
  107. };
  108.  
  109. /* Creative Labs VOC File Format */
  110.  
  111. #define TERMINATE       0x00
  112. #define VOICE           0x01
  113. #define CONTINUE        0x02
  114. #define SILENCE         0x03
  115. #define MARKER          0x04
  116. #define ASCII           0x05
  117. #define REPEAT          0x06
  118. #define VOCEND          0x07
  119. #define EXTEND          0x08
  120. #define NEWVOC          0x09
  121.  
  122. struct LABS{
  123.     char id[19];                        /* "Creative Voice File" */
  124.     char magic;                         /* 1A EOF marker         */
  125.     unsigned int offset;                /* Offset of first Data Block */
  126.     unsigned char minor_version;
  127.     unsigned char major_version;
  128.     unsigned int type;                  /* 2's compliment of Ver # + 1234h */
  129.     };
  130. struct LABSV110{                        /* Type 01 Sound Data    */
  131.     unsigned char number_samples1;
  132.     unsigned char number_samples2;
  133.     unsigned char number_samples3;
  134.     unsigned char frequency;            /* Sample Rate */
  135.     unsigned char compression;          /* Compression Type */
  136. };
  137. struct LABSV120{                        /* Type 09 New Sound Data  */
  138.     unsigned char number_samples1;
  139.     unsigned char number_samples2;
  140.     unsigned char number_samples3;
  141.     unsigned char frequency1;           /* Sample Rate   */
  142.     unsigned char frequency2;
  143.     char unknown[2];
  144.     unsigned char bits_per_sample;
  145.     unsigned char channels;
  146.     unsigned char compression;
  147.     char reserved[5];
  148. };
  149.  
  150. /* Microsoft WAV File Format */
  151.  
  152. #define RIFF  0x46464952
  153. #define WAVE  0x45564157
  154. #define FMT   0x20746d66
  155. #define WDATA 0x61746164
  156. #define WLIST 0x5453494c
  157. #define INAM  0x494e414d                /* "INAM" Name of Data */
  158. #define ICOP  0x49434f50                /* "ICOP" Copywrite notice */
  159. #define ISFT  0x49534654                /* "ISFT"  Name of Creating Software*/
  160. #define ICRD  0x49435244                /* "ICRD"  Creation Date */
  161. #define FACT  0x74636166                /* "fact" */
  162.  
  163. struct RIFFWAVE{
  164.     unsigned long id;                   /* "RIFF" */
  165.     unsigned long chunk_size;
  166.     unsigned long form_type;            /* "WAVE" */
  167. };
  168. struct SUBCHUNK{
  169.    unsigned long id;
  170.    unsigned long subchunk_size;
  171. };
  172.  
  173. struct WAVEfmt{
  174.    unsigned int format_tag;
  175.    unsigned int channels;
  176.    unsigned long number_samples_per_second;
  177.    unsigned long bytes_per_second;
  178.    unsigned int bytes_per_sample;
  179.    unsigned int bits_per_sample;
  180. };
  181.  
  182. struct RIFFLIST{
  183.    unsigned long id;                    /* "LIST" */
  184.    unsigned long chunk_size;
  185.    unsigned long form_type;             /* "INFO" */
  186. };
  187.  
  188. struct FACTinfo{
  189.    unsigned long number_samples;
  190. };
  191.  
  192. /* Apple & Electronic Arts IFF files */
  193.  
  194. #define FORM 0x4d524f46
  195. #define SVX  0x58565338
  196. #define VHDR 0x52444856
  197. #define BODY 0x59444f42
  198. #define ANNO 0x4f4e4e41
  199. #define AUTH 0x48545541
  200. #define NAME 0x454D414E
  201. #define AIFF 0x46464941
  202. #define COMM 0x4d4d4f43
  203. #define INST 0x54534e49
  204. #define SSND 0x444e5353
  205.  
  206. struct SOUNDIFF{
  207.     unsigned long id;                   /* "FORM" */
  208.     unsigned long chunk_size;
  209.     unsigned long form_type;            /* "8SVX" */
  210. };
  211.  
  212. struct IFFvhdr{
  213.    unsigned long number_samples;        /* samples 1-shot part */
  214.    unsigned long repeat_samples;        /* samples repeat part */
  215.    unsigned long samples_per_cycle;     /* samples per second if repeat */
  216.    unsigned int samples_per_second;     /* samples per second */
  217.    unsigned char octaves;               /* number of octaves */
  218.    unsigned char compression;           /* 0=none, 1=Fibonacci-delta */
  219.    unsigned long volume;                /* 65536 means full volume */
  220. };
  221.  
  222. struct AIFFCOMM{
  223.    unsigned int channels;               /* number of channels */
  224.    unsigned long number_samples;        /* number of samples */
  225.    unsigned int bits_per_sample;        /* sample width */
  226.    double long frequency;               /* frequency in ieee format */
  227. };
  228.  
  229. /* Amiga Protraker Module Format */
  230.  
  231. #define M_k_ 0x2E4B2E4D                 /* M.K. */
  232. #define FLT4 0x34544C46                 /* FLT4 */
  233.  
  234. struct MODhdr{
  235.     char name[20];                     /* ascii */
  236. };
  237.  
  238. struct MODsample{
  239.     char name[22];                     /* ascii */
  240.     unsigned int number_samples;         /* MM format in Words */
  241.     char finetune;                       /* Fine tune nibble */
  242.     char volume;                         /* Volume 0-64 */
  243.     unsigned int r_start;                /* Repeat point in mm words */
  244.     unsigned int r_length;               /* Repeat length in mm words */
  245. };
  246.  
  247. struct MODsong{
  248.     char s_length;                       /* Song length 1 to 128 */
  249.     char unknown;                        /* frequently 7f */
  250.     char sequence[128];                  /* Play sequences 0-127 */
  251. };
  252.  
  253. struct MODraw{
  254.     char *psam;                          /* Pointer to sample */
  255.     long int number_samples;             /* Number of samples */
  256.     unsigned int frequency;              /* Playback frequency */
  257. };
  258.  
  259. /* Define maximum header size for unknown file types */
  260.  
  261. #define MAX_HEADER 128
  262.  
  263. /* MAC Binary Header Format */
  264.  
  265. struct MACBINARY {
  266.  
  267.    char zerobyte;                        /* always zero */
  268.    char length;                          /* 0 - 31 */
  269.    char name[63];                        /* name and some filler */
  270.    long type;                            /* MAC file type */
  271.    long creator;                         /* MAC file creator */
  272.    char filler[10];
  273.    long datafork_size;                   /* length of MAC data fork */
  274.    long rsrcfork_size;                   /* length of MAC resource fork */
  275.    long creation_date;                   /* time of file's creation */
  276.    long modif_date;                      /* time of file's modification */
  277.    char filler2[29];
  278. };
  279.  
  280. #define MACTYPE 0x44535346
  281. #define HCOM    0x4d4f4348
  282.  
  283. /* SUN au header format */
  284.  
  285. struct SUN {
  286.  
  287.    long id;                              /* .snd */
  288.    long chunk_size;                      /* Size of header */
  289.    long data_size;                       /* Number of samples */
  290.    long compression;                     /* type of encoding */
  291.    long frequency;                       /* Sample rate */
  292.    long channels;                        /* Number of sound channels */
  293. };
  294.  
  295. #define AU_SND  0x646e732e
  296. /* STEVE files header format */
  297.  
  298. struct STEVE {
  299.    char id[5];                          /* STEVE */
  300.    char version;                        /* 1 or 2 */
  301.    char H;                              /* H */
  302.    long number_samples;                 /* Number of samples */
  303.    char filler[19];                     /* Unknown or unused */
  304.    unsigned int frequency;              /* Playback frequency for type 2 */
  305. };
  306.